package com.yc.spring.aop;


import com.yc.spring.bbs.bean.User;
import com.yc.spring.bbs.dao.UserDao;
import com.yc.spring.bbs.dao.UserDaoImpl;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import java.util.List;

//代理模式方式一：基于接口实现
//代理对象
@Component
public class UserDaoProxy1 implements UserDao {


    //真实主题（被代理对象 ，目标对象）
    UserDao userDaoImpl = new UserDaoImpl();

    @Override
    public void insert(User user) {
        System.out.println("-------静态代理：前置增强 insert----------");
        userDaoImpl.insert(user);
        System.out.println("-------静态代理：后置增强 insert----------");
    }

    @Override
    public void update(User user) {
        System.out.println("-------静态代理：前置增强 update----------");
        userDaoImpl.update(user);
        System.out.println("-------静态代理：后置增强 update----------");

    }

    @Override
    public void delete(User user) {

    }

    @Override
    public void selectOne(Object id) {

    }

    @Override
    public List<User> selectList(User user, Integer page, Integer rows) {
        return null;
    }

    @Override
    public long count(User user) {
        return 0;
    }
}
